package net.wzw.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wzw
 * @date 2025/4/21
 * @Description
 */
public enum DeleteStatus {

    /**
     * 未删除
     */
    NO_DEL(0,"未删除"),

    /**
     * 已删除
     */
    YES_DEL(1,"未删除");

    private Integer status;

    private String msg;

    DeleteStatus(Integer status,String msg){
        this.status = status;
        this.msg = msg;

    }


    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public static Map<Integer,String> toMap(){

        Map<Integer,String> map = new HashMap<>(16);
        for (DeleteStatus element : DeleteStatus.values()){

            map.put(element.getStatus(),element.getMsg());

        }

        return  map;

    }


    /**
     * 获取状态对应的信息
     * @param code
     * @return
     */
    public static DeleteStatus getByStatus(Integer code){
        for(DeleteStatus element : DeleteStatus.values()){
            if (code.equals(element.getStatus())) {
                return element;
            }
        }
        return null;
    }

}
